package com.cungmua.app.model.request;

import com.cungmua.app.utils.AppUtils;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * Created by kelvin.nguyen on 6/25/14.
 */
public class PlaceOrderRequest extends AuthenticatedRequest {
    private int userId;
    private int cityId;
    private int shipAddressId;
    private String productList;
    private int paymentType;
    private int bankId;
    private String voucherCode;
    private String note;

    public PlaceOrderRequest(String deviceId, String token) {
        super(deviceId, token);
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public void setCityId(int cityId) {
        this.cityId = cityId;
    }

    public void setShipAddressId(int shipAddressId) {
        this.shipAddressId = shipAddressId;
    }

    public void setProductList(String productList) {
        this.productList = productList;
    }

    public void setPaymentType(int paymentType) {
        this.paymentType = paymentType;
    }

    public void setBankId(int bankId) {
        this.bankId = bankId;
    }

    public void setVoucherCode(String voucherCode) {
        this.voucherCode = voucherCode;
    }

    public void setNote(String note) {
        this.note = note;
    }

    @JsonProperty("UserId")
    public int getUserId() {
        return userId;
    }

    @JsonProperty("CityId")
    public int getCityId() {
        return cityId;
    }

    @JsonProperty("ShipAddressId")
    public int getShipAddressId() {
        return shipAddressId;
    }

    @JsonProperty("ProductList")
    public String getProductList() {
        return productList;
    }

    @JsonProperty("PaymentType")
    public int getPaymentType() {
        return paymentType;
    }

    @JsonProperty("BankId")
    public int getBankId() {
        return bankId;
    }

    @JsonProperty("VoucherCode")
    public String getVoucherCode() {
        return voucherCode;
    }

    @JsonProperty("Note")
    public String getNote() {
        return note;
    }

    @Override
    public String getSign() {
        String signa=AppUtils.MD5(String.valueOf(getUserId()) + getCityId() + getShipAddressId() +
                getProductList() + getPaymentType() + getBankId() + getVoucherCode() +
                getNote() + getVersion() + getDeviceId() + getToken());

        return AppUtils.MD5(String.valueOf(getUserId()) + getCityId() + getShipAddressId() +
                getProductList() + getPaymentType() + getBankId() + getVoucherCode() +
                getNote() + getVersion() + getDeviceId() + getToken());
    }
}

